#ifndef _GAMEBOARD_H_
#define _GAMEBOARD_H_

#include "Cell.h"       //For the Color enum.
#include <utility>
#include <windows.h>   // WinApi header
using std::pair;
const int NUM_COLORS = 6;

static int wins = 0;
static int runs = 0;

class GameBoard
{
private:
        Color _ColorOfNextFlood;        
        Cell ** _masterptr;                       //The pointer to the game board. This pointer points to the master block
                                                                          //in the upper left corner.

        int numFloods;                            //The number of turns taken
        int nextToColorTracker[NUM_COLORS];     //Keeps tracks of number of cells of each color next to the flood
                                                
		pair <int, Color> colorPriority;
		int colorPriorityCompare;
		int displayColor;
		HANDLE  hConsole;
		int SIZE;
		int numR, numG, numB, numY, numP, numO;	//The number of each cell on the gameboard
		int numberOfTries;	//Small board = 22 tries, medium = 30 tries, large = 36 tries
		int currentTry;
		int gameType;
		char userColorChoice;


public:
        GameBoard(int size, int gameType);    //Will define and populate gameboard with user specified
                                //size and random colors. 12x12, 17x17, and 22x22 are the size options.
		~GameBoard();


        void DisplayBoard(int size);		//Will use the _masterptr to display/update board
		void countColorNextToFlooded(Color);//Counts the number of cells one cell away from the flooded area
		void ColorCycle();					//Cycles through the colors each turn to find the highest priority color
		int getPriority();					//Returns the priority of the highest priority color found (an int)
		void AssignNextTo();				//Loops through the board to mark cells next to the flooded area
		void Flooder(Color);				//Changes the color of each flooded cell, and sets each NextTo cell to flooded
		void VeinOfNextTo(int, int);		//Uses recursion to find each cell that is part of a vein touching the flooded area
		//void GameBoardColorChange(Color);	//Changes the color of each flooded cell
		void GetCellColor(int, int);		//Returns an int (displayColor), that will tell cout what color to display
		bool GameEnd();						//Checks the board each turn for a win, returns a bool
		Color getMasterColor();				//Returns the color of the cell at [0][0]
		void GameDriver();					//The function calling the other functions to drive the game
		void addToColor(char);				//
		void minusFromColor(char);
		void checkForElimination();
		void setGameType(int type) { gameType = type; }
};

#endif _GAMEBOARD_H_
